package com.github.catvod.spider.merge;

import com.github.catvod.crawler.SpiderDebug;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.X509TrustManager;
import okhttp3.Call;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Response;

public class fP {
  private static OkHttpClient V0;
  
  private static final Object h = new Object();
  
  private static OkHttpClient j;
  
  private static final MediaType q = MediaType.parse("application/x-protobuf");
  
  public static void BQ(OkHttpClient paramOkHttpClient, String paramString, Map<String, String> paramMap1, Map<String, String> paramMap2, L paramL) {
    (new g("POST", paramString, paramMap1, paramMap2, paramL)).h(paramOkHttpClient);
  }
  
  public static String F8(String paramString, Map<String, String> paramMap, Map<String, List<String>> paramMap1) {
    return t(j(), paramString, null, null, paramMap, paramMap1);
  }
  
  public static String I(Map<String, List<String>> paramMap) {
    return (paramMap == null) ? null : (paramMap.containsKey("location") ? ((List<String>)paramMap.get("location")).get(0) : (paramMap.containsKey("Location") ? ((List<String>)paramMap.get("Location")).get(0) : null));
  }
  
  public static String Qy(String paramString1, String paramString2, Map<String, String> paramMap) {
    return t(j(), paramString1, paramString2, null, paramMap, null);
  }
  
  public static void V0(OkHttpClient paramOkHttpClient, Object paramObject) {
    if (paramOkHttpClient != null && paramObject != null) {
      for (Call call : paramOkHttpClient.dispatcher().queuedCalls()) {
        if (paramObject.equals(call.request().tag()))
          call.cancel(); 
      } 
      for (Call call : paramOkHttpClient.dispatcher().runningCalls()) {
        if (paramObject.equals(call.request().tag()))
          call.cancel(); 
      } 
    } 
  }
  
  public static void W(OkHttpClient paramOkHttpClient, String paramString1, String paramString2, Map<String, String> paramMap, L paramL) {
    (new g("POST", paramString1, paramString2, paramMap, paramL)).h(paramOkHttpClient);
  }
  
  public static void h(Object paramObject) {
    V0(j(), paramObject);
  }
  
  public static String i4(String paramString, Map<String, String> paramMap, Map<String, List<String>> paramMap1) {
    return t(oC(), paramString, null, null, paramMap, paramMap1);
  }
  
  public static String iU(OkHttpClient paramOkHttpClient, String paramString1, String paramString2, Map<String, String> paramMap1, Map<String, String> paramMap2, Map<String, List<String>> paramMap) {
    Tw tw = new Tw(paramMap);
    g g = new g("GET", paramString1, paramMap1, paramMap2, tw);
    g.oC(paramString2);
    g.h(paramOkHttpClient);
    return tw.getResult();
  }
  
  public static OkHttpClient j() {
    synchronized (h) {
      if (V0 == null) {
        OkHttpClient.Builder builder1 = new OkHttpClient.Builder();
        this();
        TimeUnit timeUnit = TimeUnit.SECONDS;
        OkHttpClient.Builder builder2 = builder1.readTimeout(15L, timeUnit).writeTimeout(15L, timeUnit).connectTimeout(15L, timeUnit).retryOnConnectionFailure(true);
        k6 k6 = new k6();
        X509TrustManager x509TrustManager = k6.j;
        this(x509TrustManager);
        V0 = builder2.sslSocketFactory(k6, x509TrustManager).build();
      } 
      return V0;
    } 
  }
  
  public static String n(String paramString, Map<String, String> paramMap) {
    return iU(j(), paramString, null, null, paramMap, null);
  }
  
  public static OkHttpClient oC() {
    synchronized (h) {
      if (j == null) {
        OkHttpClient.Builder builder = new OkHttpClient.Builder();
        this();
        TimeUnit timeUnit = TimeUnit.SECONDS;
        builder = builder.readTimeout(15L, timeUnit).writeTimeout(15L, timeUnit).connectTimeout(15L, timeUnit).followRedirects(false).followSslRedirects(false).retryOnConnectionFailure(true);
        k6 k6 = new k6();
        X509TrustManager x509TrustManager = k6.j;
        this(x509TrustManager);
        j = builder.sslSocketFactory(k6, x509TrustManager).build();
      } 
      return j;
    } 
  }
  
  public static String oq(String paramString, Map<String, String> paramMap) {
    return t(j(), paramString, null, null, paramMap, null);
  }
  
  public static void q(OkHttpClient paramOkHttpClient, String paramString, Map<String, String> paramMap1, Map<String, String> paramMap2, L paramL) {
    (new g("GET", paramString, paramMap1, paramMap2, paramL)).h(paramOkHttpClient);
  }
  
  public static String t(OkHttpClient paramOkHttpClient, String paramString1, String paramString2, Map<String, String> paramMap1, Map<String, String> paramMap2, Map<String, List<String>> paramMap) {
    yh yh = new yh(paramMap);
    g g = new g("GET", paramString1, paramMap1, paramMap2, yh);
    g.oC(paramString2);
    g.h(paramOkHttpClient);
    return yh.getResult();
  }
  
  public static void u(OkHttpClient paramOkHttpClient, String paramString, Map<String, String> paramMap1, Map<String, String> paramMap2, Map<String, List<String>> paramMap) {
    (new k("POST", paramString, paramMap1, paramMap2, paramMap)).h(paramOkHttpClient);
  }
  
  static final class Tw extends L<String> {
    final Map V0;
    
    Tw(Map param1Map) {}
    
    public void onFailure(Call param1Call, Exception param1Exception) {
      V0((T)"");
      SpiderDebug.log(param1Exception);
    }
    
    public String onParseResponse(Call param1Call, Response param1Response) {
      try {
        Map map = this.V0;
        if (map != null) {
          map.clear();
          this.V0.putAll(param1Response.headers().toMultimap());
        } 
        return new String(param1Response.body().bytes(), "GB2312");
      } catch (IOException iOException) {
        return "";
      } 
    }
    
    public String onResponse(String param1String) {
      return param1String;
    }
  }
  
  static final class yh extends L<String> {
    final Map V0;
    
    yh(Map param1Map) {}
    
    public void onFailure(Call param1Call, Exception param1Exception) {
      V0((T)"");
      SpiderDebug.log(param1Exception);
    }
    
    public String onParseResponse(Call param1Call, Response param1Response) {
      try {
        Map map = this.V0;
        if (map != null) {
          map.clear();
          this.V0.putAll(param1Response.headers().toMultimap());
        } 
        return param1Response.body().string();
      } catch (IOException iOException) {
        return "";
      } 
    }
    
    public String onResponse(String param1String) {
      return param1String;
    }
  }
}


/* Location:              /Users/hetaiyi/Desktop/my/tech/java/study/aa/temp/temp.jar!/com/github/catvod/spider/merge/fP.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */